Skip to content

GH-132554: Fix tier2 FOR_ITER implementation and optimizations - #135137

Merged
markshannon merged 4 commits into
python:mainfrom
faster-cpython:fix-tier2-for-iter
Jun 5, 2025
Merged

markshannon merged 4 commits into
python:mainfrom
faster-cpython:fix-tier2-for-iter

Conversation

@markshannon

@markshannon markshannon commented Jun 4, 2025 •

Copy link
Copy Markdown
Member

When adding virtual iterators, the tier 1 and tier 2 implementations of FOR_ITER diverged. I've already fixed a problem where the instrumented FOR_ITER differed from the normal one.

To prevent these problems happening again, this PR factors out the majority of FOR_ITER into a helper function for the 3 versions of FOR_ITER to share.

I've also added PyStackRef_ERROR to distinguish between errors and no result and remove the need for an additional out parameter for the helper function.

Also fixes a bug in the code generator where there are three or more output values, one is an unchanged input, one is a changed input and one is undefined.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants